package com.cndw.kungfu.dao;

import com.cndw.dao.jade.annotation.DAO;
import com.cndw.dao.jade.annotation.SQL;
import com.cndw.dao.jade.annotation.SQLParam;
import com.cndw.kungfu.domain.Livery;

@DAO
public interface LiveryDao {
	public static final String table = "kf_player_livery";
	public static final String fields = "playerId, cardId, beginTime, endTime, escapeTime, masterId, liveries, losers, robEnemies";
	
	@SQL("select "+fields+" from "+table+" where playerId=:playerId ")
	public Livery select(@SQLParam("playerId") long playerId);
	
	@SQL("update "+table+" set cardId =:l.cardId, beginTime =:l.beginTime , endTime =:l.endTime,  escapeTime =:l.escapeTime, masterId=:l.masterId, liveries =:l.liveries, losers =:l.losers, robEnemies =:l.robEnemies where playerId=:l.playerId")
	public void update(@SQLParam("l")Livery l);
	
	@SQL("replace into "+table+" set playerId =:l.playerId, cardId =:l.cardId, beginTime =:l.beginTime , endTime =:l.endTime,  escapeTime =:l.escapeTime, masterId=:l.masterId, liveries =:l.liveries, losers =:l.losers, robEnemies =:l.robEnemies")
	public void save(@SQLParam("l")Livery l);
}
